﻿package app.view.components.guiDima 
{
	import app.view.components.buttons.SelectableButton;
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.events.MouseEvent;
	/**
	 * ...
	 * @author www
	 */
	public class PageBtnD extends Sprite
	{
		
	//	public
		
		//	private
		private var _selected:Boolean;
		//	const
		private var _btn:PageBtnViewD;
		private var _id:Number;
		
		//	CONSTRUCTOR
		public function PageBtnD(id:Number) 
		{
			_id=id
			
			init();
		}
		
		//	METHODS
		//	private
		private function init():void
		{
			_btn = new PageBtnViewD();
			_btn.value.text = String(_id + 1);
			addChild(_btn);
			
			addEventListener(MouseEvent.CLICK, onClick);
			this.doubleClickEnabled = true;
		}
		
		
		//	public
		public function destroy():void
		{
			removeChild(_btn);
		}
		
		public function updateDisplayList(sw:Number,sh:Number):void
		{
			
		}
		
		public function get id():Number { return _id; }
		
		public function set id(value:Number):void 
		{
			_id = value;
		}
		
		public function get selected():Boolean { return _selected; }
		
		public function set selected(value:Boolean):void 
		{
			_selected = value;
			
			_btn.selected = _selected;
		}
		//	----------------------------------------------------------------------------------
		
		//	GETTERS/SETTERS
		
		//	----------------------------------------------------------------------------------
		
		//	HANDLERS
		private function onClick(e:MouseEvent):void 
		{
			var ev:Event= new Event(Event.CHANGE);
			dispatchEvent(ev);
		}
		
	}

}